package jfs;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import filesystem.File;
import filesystem.FileSystem;
import filesystem.Tag;


public class JasonsFileSystem implements FileSystem
{
  // Data
  Set<Tag> tags = new HashSet<Tag>();
  Set<File> files = new HashSet<File>();
  
//  Map<Tag, File> tagToFiles = new HashMap<Tag, File>();
  
  Map<Tag, String> tagNames = new HashMap<Tag, String>();
  Map<String, Tag> nameToTag = new HashMap<String, Tag>();
  
  Map<File, String> fileNames = new HashMap<File, String>();
  Map<String, File> nameToFile = new HashMap<String, File>();
  
  Deque<Short> tagPool = new ArrayDeque<Short>();
  Deque<Long> filePool = new ArrayDeque<Long>();
  
  
  //--------------------
  // Interface Methods
  //--------------------
  @Override
  public void addTag(File f, Tag t)
  {
  // TODO Auto-generated method stub
  }
  @Override
  public String getFileName(File f)
  {
    return fileNames.get(f);
  }
  @Override
  public short[] getFileTags(File f)
  {
    // TODO Auto-generated method stub
    return null;
  }
  @Override
  public String getTagName(Tag t)
  {
    return null;
  }
  @Override
  public Tag newTag(String name)
  {
    if (nameToTag.containsKey(name) == false)
    {
      Tag newTag = new JTag(nextTag());
      return newTag;
    }
    return null;
  }
  @Override
  public void removeAllTags(File f, Tag t)
  {
  // TODO Auto-generated method stub
  }
  @Override
  public void removeTag(File f, Tag t)
  {
  // TODO Auto-generated method stub
  }
  
  
  //----------------------
  // Methods
  //----------------------
  
  protected short nextTag()
  {
    return tagPool.pop();
  }
  protected long nextFile()
  {
    return filePool.pop();
  }
  
}
